// $ANTLR 3.2 Sep 23, 2009 12:02:23 WJTreeWalker.g 2013-12-11 02:51:49
 
  package wj;
  import wj.tree.*;
  import wj.tree.functions.*;
  import java.util.HashMap;


import org.antlr.runtime.*;
import org.antlr.runtime.tree.*;import java.util.Stack;
import java.util.List;
import java.util.ArrayList;

public class WJTreeWalker extends TreeParser {
    public static final String[] tokenNames = new String[] {
        "<invalid>", "<EOR>", "<DOWN>", "<UP>", "BLOCK", "STATEMENTS", "RETURN", "DECLARATION", "ASSIGNMENT", "ARG_LIST", "PARAM_LIST", "FUNCTION_CALL", "IF", "ELSE_IF", "ELSE", "NEGATE", "NOT", "OR", "AND", "POW", "ADDSUB", "MULDIVMOD", "RELATIONAL", "Return", "Identifier", "CreateFunction", "WithParameters", "EndFunction", "Write", "WriteLine", "ReadString", "ReadNumber", "Connect", "Length", "CharAt", "Take", "Drop", "String", "EndIf", "If", "ElseIf", "Else", "Number", "Boolean", "Declare", "ThatReturns", "Int", "Digit", "AlphaChar", "Space", "Comment", "'.'", "'gets'", "'('", "')'", "':'", "','", "'()'", "'['", "']'", "'characters'", "'from'", "'then'", "'while'", "'is'", "'correct'", "'end while'", "'or'", "'and'", "'=='", "'!='", "'>='", "'<='", "'>'", "'<'", "'+'", "'-'", "'*'", "'/'", "'mod'", "'^'", "'!'"
    };
    public static final int T__68=68;
    public static final int T__69=69;
    public static final int T__66=66;
    public static final int T__67=67;
    public static final int T__64=64;
    public static final int T__65=65;
    public static final int T__62=62;
    public static final int T__63=63;
    public static final int Connect=32;
    public static final int CreateFunction=25;
    public static final int NOT=16;
    public static final int T__61=61;
    public static final int AND=18;
    public static final int T__60=60;
    public static final int EOF=-1;
    public static final int DECLARATION=7;
    public static final int Int=46;
    public static final int Identifier=24;
    public static final int IF=12;
    public static final int Space=49;
    public static final int T__55=55;
    public static final int T__56=56;
    public static final int T__57=57;
    public static final int T__58=58;
    public static final int EndIf=38;
    public static final int T__51=51;
    public static final int POW=19;
    public static final int T__52=52;
    public static final int Number=42;
    public static final int T__53=53;
    public static final int Take=35;
    public static final int T__54=54;
    public static final int Comment=50;
    public static final int T__59=59;
    public static final int RETURN=6;
    public static final int WithParameters=26;
    public static final int String=37;
    public static final int ReadNumber=31;
    public static final int Return=23;
    public static final int AlphaChar=48;
    public static final int If=39;
    public static final int ELSE_IF=13;
    public static final int T__80=80;
    public static final int T__81=81;
    public static final int EndFunction=27;
    public static final int ELSE=14;
    public static final int Declare=44;
    public static final int ARG_LIST=9;
    public static final int NEGATE=15;
    public static final int ElseIf=40;
    public static final int Drop=36;
    public static final int Write=28;
    public static final int Digit=47;
    public static final int RELATIONAL=22;
    public static final int PARAM_LIST=10;
    public static final int T__71=71;
    public static final int T__72=72;
    public static final int ADDSUB=20;
    public static final int MULDIVMOD=21;
    public static final int T__70=70;
    public static final int Boolean=43;
    public static final int BLOCK=4;
    public static final int OR=17;
    public static final int WriteLine=29;
    public static final int STATEMENTS=5;
    public static final int ASSIGNMENT=8;
    public static final int CharAt=34;
    public static final int ReadString=30;
    public static final int Length=33;
    public static final int T__76=76;
    public static final int FUNCTION_CALL=11;
    public static final int T__75=75;
    public static final int Else=41;
    public static final int T__74=74;
    public static final int T__73=73;
    public static final int ThatReturns=45;
    public static final int T__79=79;
    public static final int T__78=78;
    public static final int T__77=77;

    // delegates
    // delegators


        public WJTreeWalker(TreeNodeStream input) {
            this(input, new RecognizerSharedState());
        }
        public WJTreeWalker(TreeNodeStream input, RecognizerSharedState state) {
            super(input, state);
             
        }
        

    public String[] getTokenNames() { return WJTreeWalker.tokenNames; }
    public String getGrammarFileName() { return "WJTreeWalker.g"; }


    	
    	private Scope currentScope = Scope.GLOBAL_SCOPE;
    	
    	public WJTreeWalker(CommonTreeNodeStream nodes, Scope currentScope){
    		super(nodes);
    		if(currentScope != null)
    			this.currentScope = currentScope;
    	}



    // $ANTLR start "walk"
    // WJTreeWalker.g:27:1: walk returns [WJNode node] : block ;
    public final WJNode walk() throws RecognitionException {
        WJNode node = null;

        WJNode block1 = null;


        try {
            // WJTreeWalker.g:28:2: ( block )
            // WJTreeWalker.g:28:4: block
            {
            pushFollow(FOLLOW_block_in_walk59);
            block1=block();

            state._fsp--;

            node = block1;

            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return node;
    }
    // $ANTLR end "walk"


    // $ANTLR start "block"
    // WJTreeWalker.g:31:1: block returns [WJNode node] : ^( BLOCK ^( STATEMENTS ( statement )* ) ^( RETURN ( expression )? ) ) ;
    public final WJNode block() throws RecognitionException {
        WJNode node = null;

        WJNode statement2 = null;

        WJNode expression3 = null;



        	BlockNode blockNode = new BlockNode();
        	node = blockNode;

        try {
            // WJTreeWalker.g:36:2: ( ^( BLOCK ^( STATEMENTS ( statement )* ) ^( RETURN ( expression )? ) ) )
            // WJTreeWalker.g:36:4: ^( BLOCK ^( STATEMENTS ( statement )* ) ^( RETURN ( expression )? ) )
            {
            match(input,BLOCK,FOLLOW_BLOCK_in_block86); 

            match(input, Token.DOWN, null); 
            match(input,STATEMENTS,FOLLOW_STATEMENTS_in_block89); 

            if ( input.LA(1)==Token.DOWN ) {
                match(input, Token.DOWN, null); 
                // WJTreeWalker.g:36:25: ( statement )*
                loop1:
                do {
                    int alt1=2;
                    int LA1_0 = input.LA(1);

                    if ( (LA1_0==ASSIGNMENT||(LA1_0>=FUNCTION_CALL && LA1_0<=IF)||LA1_0==63) ) {
                        alt1=1;
                    }


                    switch (alt1) {
                	case 1 :
                	    // WJTreeWalker.g:36:26: statement
                	    {
                	    pushFollow(FOLLOW_statement_in_block92);
                	    statement2=statement();

                	    state._fsp--;

                	    blockNode.addStatement(statement2);

                	    }
                	    break;

                	default :
                	    break loop1;
                    }
                } while (true);


                match(input, Token.UP, null); 
            }
            match(input,RETURN,FOLLOW_RETURN_in_block99); 

            if ( input.LA(1)==Token.DOWN ) {
                match(input, Token.DOWN, null); 
                // WJTreeWalker.g:36:90: ( expression )?
                int alt2=2;
                int LA2_0 = input.LA(1);

                if ( (LA2_0==OR) ) {
                    alt2=1;
                }
                switch (alt2) {
                    case 1 :
                        // WJTreeWalker.g:36:91: expression
                        {
                        pushFollow(FOLLOW_expression_in_block102);
                        expression3=expression();

                        state._fsp--;

                        blockNode.setReturn(expression3);

                        }
                        break;

                }


                match(input, Token.UP, null); 
            }

            match(input, Token.UP, null); 

            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return node;
    }
    // $ANTLR end "block"


    // $ANTLR start "statement"
    // WJTreeWalker.g:39:1: statement returns [WJNode node] : ( assignment | functionCall | ifStatement | whileStatement );
    public final WJNode statement() throws RecognitionException {
        WJNode node = null;

        WJNode assignment4 = null;

        WJNode functionCall5 = null;

        WJNode ifStatement6 = null;

        WJNode whileStatement7 = null;


        try {
            // WJTreeWalker.g:40:2: ( assignment | functionCall | ifStatement | whileStatement )
            int alt3=4;
            switch ( input.LA(1) ) {
            case ASSIGNMENT:
                {
                alt3=1;
                }
                break;
            case FUNCTION_CALL:
                {
                alt3=2;
                }
                break;
            case IF:
                {
                alt3=3;
                }
                break;
            case 63:
                {
                alt3=4;
                }
                break;
            default:
                NoViableAltException nvae =
                    new NoViableAltException("", 3, 0, input);

                throw nvae;
            }

            switch (alt3) {
                case 1 :
                    // WJTreeWalker.g:40:4: assignment
                    {
                    pushFollow(FOLLOW_assignment_in_statement127);
                    assignment4=assignment();

                    state._fsp--;

                    node = assignment4;

                    }
                    break;
                case 2 :
                    // WJTreeWalker.g:41:4: functionCall
                    {
                    pushFollow(FOLLOW_functionCall_in_statement134);
                    functionCall5=functionCall();

                    state._fsp--;

                    node = functionCall5;

                    }
                    break;
                case 3 :
                    // WJTreeWalker.g:42:4: ifStatement
                    {
                    pushFollow(FOLLOW_ifStatement_in_statement141);
                    ifStatement6=ifStatement();

                    state._fsp--;

                    node = ifStatement6;

                    }
                    break;
                case 4 :
                    // WJTreeWalker.g:43:4: whileStatement
                    {
                    pushFollow(FOLLOW_whileStatement_in_statement148);
                    whileStatement7=whileStatement();

                    state._fsp--;

                    node = whileStatement7;

                    }
                    break;

            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return node;
    }
    // $ANTLR end "statement"


    // $ANTLR start "assignment"
    // WJTreeWalker.g:46:1: assignment returns [WJNode node] : ^( ASSIGNMENT Identifier expression ) ;
    public final WJNode assignment() throws RecognitionException {
        WJNode node = null;

        CommonTree Identifier8=null;
        WJNode expression9 = null;


        try {
            // WJTreeWalker.g:47:2: ( ^( ASSIGNMENT Identifier expression ) )
            // WJTreeWalker.g:47:5: ^( ASSIGNMENT Identifier expression )
            {
            match(input,ASSIGNMENT,FOLLOW_ASSIGNMENT_in_assignment171); 

            match(input, Token.DOWN, null); 
            Identifier8=(CommonTree)match(input,Identifier,FOLLOW_Identifier_in_assignment173); 
            pushFollow(FOLLOW_expression_in_assignment175);
            expression9=expression();

            state._fsp--;


            match(input, Token.UP, null); 
             node = new AssignmentNode(currentScope, (Identifier8!=null?Identifier8.getText():null), expression9);

            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return node;
    }
    // $ANTLR end "assignment"


    // $ANTLR start "argumentList"
    // WJTreeWalker.g:50:1: argumentList returns [ArrayList<WJNode> argList] : ^( ARG_LIST ( expression )+ ) ;
    public final ArrayList<WJNode> argumentList() throws RecognitionException {
        ArrayList<WJNode> argList = null;

        WJNode expression10 = null;



        	argList = new ArrayList<WJNode>();

        try {
            // WJTreeWalker.g:54:2: ( ^( ARG_LIST ( expression )+ ) )
            // WJTreeWalker.g:54:4: ^( ARG_LIST ( expression )+ )
            {
            match(input,ARG_LIST,FOLLOW_ARG_LIST_in_argumentList198); 

            match(input, Token.DOWN, null); 
            // WJTreeWalker.g:54:15: ( expression )+
            int cnt4=0;
            loop4:
            do {
                int alt4=2;
                int LA4_0 = input.LA(1);

                if ( (LA4_0==OR) ) {
                    alt4=1;
                }


                switch (alt4) {
            	case 1 :
            	    // WJTreeWalker.g:54:16: expression
            	    {
            	    pushFollow(FOLLOW_expression_in_argumentList201);
            	    expression10=expression();

            	    state._fsp--;

            	    argList.add(expression10);

            	    }
            	    break;

            	default :
            	    if ( cnt4 >= 1 ) break loop4;
                        EarlyExitException eee =
                            new EarlyExitException(4, input);
                        throw eee;
                }
                cnt4++;
            } while (true);


            match(input, Token.UP, null); 

            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return argList;
    }
    // $ANTLR end "argumentList"


    // $ANTLR start "parameterList"
    // WJTreeWalker.g:57:1: parameterList : ^( PARAM_LIST ( Identifier )+ ) ;
    public final void parameterList() throws RecognitionException {
        try {
            // WJTreeWalker.g:58:3: ( ^( PARAM_LIST ( Identifier )+ ) )
            // WJTreeWalker.g:58:6: ^( PARAM_LIST ( Identifier )+ )
            {
            match(input,PARAM_LIST,FOLLOW_PARAM_LIST_in_parameterList219); 

            match(input, Token.DOWN, null); 
            // WJTreeWalker.g:58:19: ( Identifier )+
            int cnt5=0;
            loop5:
            do {
                int alt5=2;
                int LA5_0 = input.LA(1);

                if ( (LA5_0==Identifier) ) {
                    alt5=1;
                }


                switch (alt5) {
            	case 1 :
            	    // WJTreeWalker.g:58:19: Identifier
            	    {
            	    match(input,Identifier,FOLLOW_Identifier_in_parameterList221); 

            	    }
            	    break;

            	default :
            	    if ( cnt5 >= 1 ) break loop5;
                        EarlyExitException eee =
                            new EarlyExitException(5, input);
                        throw eee;
                }
                cnt5++;
            } while (true);


            match(input, Token.UP, null); 

            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return ;
    }
    // $ANTLR end "parameterList"


    // $ANTLR start "functionCall"
    // WJTreeWalker.g:61:1: functionCall returns [WJNode node] : ( ^( FUNCTION_CALL Write ( expression )? ) | ^( FUNCTION_CALL WriteLine ( expression )? ) | ^( FUNCTION_CALL ReadString ) | ^( FUNCTION_CALL ReadNumber ) | ^( FUNCTION_CALL Connect ( expression )+ ) | ^( FUNCTION_CALL CharAt stringExpr expression ) | ^( FUNCTION_CALL Length stringExpr ) | ^( FUNCTION_CALL Take expression stringExpr ) | ^( FUNCTION_CALL Drop expression stringExpr ) | ^( FUNCTION_CALL Identifier ( argumentList )? ) );
    public final WJNode functionCall() throws RecognitionException {
        WJNode node = null;

        CommonTree Identifier21=null;
        WJNode expression11 = null;

        WJNode expression12 = null;

        WJNode expression13 = null;

        WJNode stringExpr14 = null;

        WJNode expression15 = null;

        WJNode stringExpr16 = null;

        WJNode expression17 = null;

        WJNode stringExpr18 = null;

        WJNode expression19 = null;

        WJNode stringExpr20 = null;

        ArrayList<WJNode> argumentList22 = null;



        	ConnectNode connectNode = new ConnectNode();

        try {
            // WJTreeWalker.g:65:2: ( ^( FUNCTION_CALL Write ( expression )? ) | ^( FUNCTION_CALL WriteLine ( expression )? ) | ^( FUNCTION_CALL ReadString ) | ^( FUNCTION_CALL ReadNumber ) | ^( FUNCTION_CALL Connect ( expression )+ ) | ^( FUNCTION_CALL CharAt stringExpr expression ) | ^( FUNCTION_CALL Length stringExpr ) | ^( FUNCTION_CALL Take expression stringExpr ) | ^( FUNCTION_CALL Drop expression stringExpr ) | ^( FUNCTION_CALL Identifier ( argumentList )? ) )
            int alt10=10;
            alt10 = dfa10.predict(input);
            switch (alt10) {
                case 1 :
                    // WJTreeWalker.g:65:4: ^( FUNCTION_CALL Write ( expression )? )
                    {
                    match(input,FUNCTION_CALL,FOLLOW_FUNCTION_CALL_in_functionCall245); 

                    match(input, Token.DOWN, null); 
                    match(input,Write,FOLLOW_Write_in_functionCall247); 
                    // WJTreeWalker.g:65:26: ( expression )?
                    int alt6=2;
                    int LA6_0 = input.LA(1);

                    if ( (LA6_0==OR) ) {
                        alt6=1;
                    }
                    switch (alt6) {
                        case 1 :
                            // WJTreeWalker.g:65:26: expression
                            {
                            pushFollow(FOLLOW_expression_in_functionCall249);
                            expression11=expression();

                            state._fsp--;


                            }
                            break;

                    }


                    match(input, Token.UP, null); 
                     node = new WriteNode(expression11); 

                    }
                    break;
                case 2 :
                    // WJTreeWalker.g:66:4: ^( FUNCTION_CALL WriteLine ( expression )? )
                    {
                    match(input,FUNCTION_CALL,FOLLOW_FUNCTION_CALL_in_functionCall259); 

                    match(input, Token.DOWN, null); 
                    match(input,WriteLine,FOLLOW_WriteLine_in_functionCall261); 
                    // WJTreeWalker.g:66:30: ( expression )?
                    int alt7=2;
                    int LA7_0 = input.LA(1);

                    if ( (LA7_0==OR) ) {
                        alt7=1;
                    }
                    switch (alt7) {
                        case 1 :
                            // WJTreeWalker.g:66:30: expression
                            {
                            pushFollow(FOLLOW_expression_in_functionCall263);
                            expression12=expression();

                            state._fsp--;


                            }
                            break;

                    }


                    match(input, Token.UP, null); 
                    node = new WriteLineNode(expression12);

                    }
                    break;
                case 3 :
                    // WJTreeWalker.g:67:4: ^( FUNCTION_CALL ReadString )
                    {
                    match(input,FUNCTION_CALL,FOLLOW_FUNCTION_CALL_in_functionCall273); 

                    match(input, Token.DOWN, null); 
                    match(input,ReadString,FOLLOW_ReadString_in_functionCall275); 

                    match(input, Token.UP, null); 
                    node = new ReadStringNode();

                    }
                    break;
                case 4 :
                    // WJTreeWalker.g:68:4: ^( FUNCTION_CALL ReadNumber )
                    {
                    match(input,FUNCTION_CALL,FOLLOW_FUNCTION_CALL_in_functionCall284); 

                    match(input, Token.DOWN, null); 
                    match(input,ReadNumber,FOLLOW_ReadNumber_in_functionCall286); 

                    match(input, Token.UP, null); 
                    node = new ReadNumberNode();

                    }
                    break;
                case 5 :
                    // WJTreeWalker.g:69:4: ^( FUNCTION_CALL Connect ( expression )+ )
                    {
                    match(input,FUNCTION_CALL,FOLLOW_FUNCTION_CALL_in_functionCall295); 

                    match(input, Token.DOWN, null); 
                    match(input,Connect,FOLLOW_Connect_in_functionCall297); 
                    // WJTreeWalker.g:69:27: ( expression )+
                    int cnt8=0;
                    loop8:
                    do {
                        int alt8=2;
                        int LA8_0 = input.LA(1);

                        if ( (LA8_0==OR) ) {
                            alt8=1;
                        }


                        switch (alt8) {
                    	case 1 :
                    	    // WJTreeWalker.g:69:28: expression
                    	    {
                    	    pushFollow(FOLLOW_expression_in_functionCall299);
                    	    expression13=expression();

                    	    state._fsp--;

                    	    connectNode.addNodeToConnect(expression13);

                    	    }
                    	    break;

                    	default :
                    	    if ( cnt8 >= 1 ) break loop8;
                                EarlyExitException eee =
                                    new EarlyExitException(8, input);
                                throw eee;
                        }
                        cnt8++;
                    } while (true);


                    match(input, Token.UP, null); 
                    node = connectNode;

                    }
                    break;
                case 6 :
                    // WJTreeWalker.g:70:4: ^( FUNCTION_CALL CharAt stringExpr expression )
                    {
                    match(input,FUNCTION_CALL,FOLLOW_FUNCTION_CALL_in_functionCall311); 

                    match(input, Token.DOWN, null); 
                    match(input,CharAt,FOLLOW_CharAt_in_functionCall313); 
                    pushFollow(FOLLOW_stringExpr_in_functionCall315);
                    stringExpr14=stringExpr();

                    state._fsp--;

                    pushFollow(FOLLOW_expression_in_functionCall317);
                    expression15=expression();

                    state._fsp--;


                    match(input, Token.UP, null); 
                     node = new CharAtStringNode(stringExpr14, expression15);

                    }
                    break;
                case 7 :
                    // WJTreeWalker.g:71:4: ^( FUNCTION_CALL Length stringExpr )
                    {
                    match(input,FUNCTION_CALL,FOLLOW_FUNCTION_CALL_in_functionCall326); 

                    match(input, Token.DOWN, null); 
                    match(input,Length,FOLLOW_Length_in_functionCall328); 
                    pushFollow(FOLLOW_stringExpr_in_functionCall330);
                    stringExpr16=stringExpr();

                    state._fsp--;


                    match(input, Token.UP, null); 
                    node = new StringLengthNode(stringExpr16);

                    }
                    break;
                case 8 :
                    // WJTreeWalker.g:72:4: ^( FUNCTION_CALL Take expression stringExpr )
                    {
                    match(input,FUNCTION_CALL,FOLLOW_FUNCTION_CALL_in_functionCall339); 

                    match(input, Token.DOWN, null); 
                    match(input,Take,FOLLOW_Take_in_functionCall341); 
                    pushFollow(FOLLOW_expression_in_functionCall343);
                    expression17=expression();

                    state._fsp--;

                    pushFollow(FOLLOW_stringExpr_in_functionCall345);
                    stringExpr18=stringExpr();

                    state._fsp--;


                    match(input, Token.UP, null); 
                     node = new TakeNode(expression17, stringExpr18);

                    }
                    break;
                case 9 :
                    // WJTreeWalker.g:73:4: ^( FUNCTION_CALL Drop expression stringExpr )
                    {
                    match(input,FUNCTION_CALL,FOLLOW_FUNCTION_CALL_in_functionCall354); 

                    match(input, Token.DOWN, null); 
                    match(input,Drop,FOLLOW_Drop_in_functionCall356); 
                    pushFollow(FOLLOW_expression_in_functionCall358);
                    expression19=expression();

                    state._fsp--;

                    pushFollow(FOLLOW_stringExpr_in_functionCall360);
                    stringExpr20=stringExpr();

                    state._fsp--;


                    match(input, Token.UP, null); 
                    node = new DropNode(expression19, stringExpr20);

                    }
                    break;
                case 10 :
                    // WJTreeWalker.g:74:4: ^( FUNCTION_CALL Identifier ( argumentList )? )
                    {
                    match(input,FUNCTION_CALL,FOLLOW_FUNCTION_CALL_in_functionCall369); 

                    match(input, Token.DOWN, null); 
                    Identifier21=(CommonTree)match(input,Identifier,FOLLOW_Identifier_in_functionCall371); 
                    // WJTreeWalker.g:74:31: ( argumentList )?
                    int alt9=2;
                    int LA9_0 = input.LA(1);

                    if ( (LA9_0==ARG_LIST) ) {
                        alt9=1;
                    }
                    switch (alt9) {
                        case 1 :
                            // WJTreeWalker.g:74:31: argumentList
                            {
                            pushFollow(FOLLOW_argumentList_in_functionCall373);
                            argumentList22=argumentList();

                            state._fsp--;


                            }
                            break;

                    }


                    match(input, Token.UP, null); 
                      node = new FunctionCallNode((Identifier21!=null?Identifier21.getText():null), argumentList22);

                    }
                    break;

            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return node;
    }
    // $ANTLR end "functionCall"


    // $ANTLR start "stringExpr"
    // WJTreeWalker.g:77:1: stringExpr returns [WJNode node] : ( String | Identifier );
    public final WJNode stringExpr() throws RecognitionException {
        WJNode node = null;

        CommonTree String23=null;
        CommonTree Identifier24=null;

        try {
            // WJTreeWalker.g:78:2: ( String | Identifier )
            int alt11=2;
            int LA11_0 = input.LA(1);

            if ( (LA11_0==String) ) {
                alt11=1;
            }
            else if ( (LA11_0==Identifier) ) {
                alt11=2;
            }
            else {
                NoViableAltException nvae =
                    new NoViableAltException("", 11, 0, input);

                throw nvae;
            }
            switch (alt11) {
                case 1 :
                    // WJTreeWalker.g:78:4: String
                    {
                    String23=(CommonTree)match(input,String,FOLLOW_String_in_stringExpr393); 
                    node = new AtomNode(new WJValue((String23!=null?String23.getText():null)));

                    }
                    break;
                case 2 :
                    // WJTreeWalker.g:79:4: Identifier
                    {
                    Identifier24=(CommonTree)match(input,Identifier,FOLLOW_Identifier_in_stringExpr400); 
                    node = new RetrieveNode(currentScope, (Identifier24!=null?Identifier24.getText():null));

                    }
                    break;

            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return node;
    }
    // $ANTLR end "stringExpr"


    // $ANTLR start "ifStatement"
    // WJTreeWalker.g:82:1: ifStatement returns [WJNode node] : ^( IF ifStatementPart ( elseIfStatementPart )* ( elseStatementPart )? ) ;
    public final WJNode ifStatement() throws RecognitionException {
        WJNode node = null;

        IfBlockNode ifStatementPart25 = null;

        IfBlockNode elseIfStatementPart26 = null;

        IfBlockNode elseStatementPart27 = null;



        	IfStatementNode ifNode = new IfStatementNode();
        	node = ifNode;

        try {
            // WJTreeWalker.g:87:2: ( ^( IF ifStatementPart ( elseIfStatementPart )* ( elseStatementPart )? ) )
            // WJTreeWalker.g:87:4: ^( IF ifStatementPart ( elseIfStatementPart )* ( elseStatementPart )? )
            {
            match(input,IF,FOLLOW_IF_in_ifStatement424); 

            match(input, Token.DOWN, null); 
            pushFollow(FOLLOW_ifStatementPart_in_ifStatement426);
            ifStatementPart25=ifStatementPart();

            state._fsp--;

            ifNode.addIfBlock(ifStatementPart25);
            // WJTreeWalker.g:87:73: ( elseIfStatementPart )*
            loop12:
            do {
                int alt12=2;
                int LA12_0 = input.LA(1);

                if ( (LA12_0==ELSE_IF) ) {
                    alt12=1;
                }


                switch (alt12) {
            	case 1 :
            	    // WJTreeWalker.g:87:74: elseIfStatementPart
            	    {
            	    pushFollow(FOLLOW_elseIfStatementPart_in_ifStatement430);
            	    elseIfStatementPart26=elseIfStatementPart();

            	    state._fsp--;

            	    ifNode.addIfBlock(elseIfStatementPart26);

            	    }
            	    break;

            	default :
            	    break loop12;
                }
            } while (true);

            // WJTreeWalker.g:87:148: ( elseStatementPart )?
            int alt13=2;
            int LA13_0 = input.LA(1);

            if ( (LA13_0==ELSE) ) {
                alt13=1;
            }
            switch (alt13) {
                case 1 :
                    // WJTreeWalker.g:87:149: elseStatementPart
                    {
                    pushFollow(FOLLOW_elseStatementPart_in_ifStatement436);
                    elseStatementPart27=elseStatementPart();

                    state._fsp--;

                    ifNode.addIfBlock(elseStatementPart27);

                    }
                    break;

            }


            match(input, Token.UP, null); 

            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return node;
    }
    // $ANTLR end "ifStatement"


    // $ANTLR start "ifStatementPart"
    // WJTreeWalker.g:90:1: ifStatementPart returns [IfBlockNode blockNode] : ^( IF expression block ) ;
    public final IfBlockNode ifStatementPart() throws RecognitionException {
        IfBlockNode blockNode = null;

        WJNode expression28 = null;

        WJNode block29 = null;


        try {
            // WJTreeWalker.g:91:2: ( ^( IF expression block ) )
            // WJTreeWalker.g:91:4: ^( IF expression block )
            {
            match(input,IF,FOLLOW_IF_in_ifStatementPart457); 

            match(input, Token.DOWN, null); 
            pushFollow(FOLLOW_expression_in_ifStatementPart459);
            expression28=expression();

            state._fsp--;

            pushFollow(FOLLOW_block_in_ifStatementPart461);
            block29=block();

            state._fsp--;


            match(input, Token.UP, null); 
            blockNode = new IfBlockNode(expression28, block29);

            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return blockNode;
    }
    // $ANTLR end "ifStatementPart"


    // $ANTLR start "elseIfStatementPart"
    // WJTreeWalker.g:94:1: elseIfStatementPart returns [IfBlockNode blockNode] : ^( ELSE_IF expression block ) ;
    public final IfBlockNode elseIfStatementPart() throws RecognitionException {
        IfBlockNode blockNode = null;

        WJNode expression30 = null;

        WJNode block31 = null;


        try {
            // WJTreeWalker.g:95:2: ( ^( ELSE_IF expression block ) )
            // WJTreeWalker.g:95:4: ^( ELSE_IF expression block )
            {
            match(input,ELSE_IF,FOLLOW_ELSE_IF_in_elseIfStatementPart480); 

            match(input, Token.DOWN, null); 
            pushFollow(FOLLOW_expression_in_elseIfStatementPart482);
            expression30=expression();

            state._fsp--;

            pushFollow(FOLLOW_block_in_elseIfStatementPart484);
            block31=block();

            state._fsp--;


            match(input, Token.UP, null); 
            blockNode = new IfBlockNode(expression30, block31);

            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return blockNode;
    }
    // $ANTLR end "elseIfStatementPart"


    // $ANTLR start "elseStatementPart"
    // WJTreeWalker.g:98:1: elseStatementPart returns [IfBlockNode blockNode] : ^( ELSE block ) ;
    public final IfBlockNode elseStatementPart() throws RecognitionException {
        IfBlockNode blockNode = null;

        WJNode block32 = null;


        try {
            // WJTreeWalker.g:99:2: ( ^( ELSE block ) )
            // WJTreeWalker.g:99:4: ^( ELSE block )
            {
            match(input,ELSE,FOLLOW_ELSE_in_elseStatementPart504); 

            match(input, Token.DOWN, null); 
            pushFollow(FOLLOW_block_in_elseStatementPart506);
            block32=block();

            state._fsp--;


            match(input, Token.UP, null); 
            blockNode = new IfBlockNode(new AtomNode(new WJValue(true)), block32);

            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return blockNode;
    }
    // $ANTLR end "elseStatementPart"


    // $ANTLR start "whileStatement"
    // WJTreeWalker.g:102:1: whileStatement returns [WJNode node] : ^( 'while' expression 'is' 'correct' ':' block 'end while' ) ;
    public final WJNode whileStatement() throws RecognitionException {
        WJNode node = null;

        WJNode expression33 = null;

        WJNode block34 = null;


        try {
            // WJTreeWalker.g:103:2: ( ^( 'while' expression 'is' 'correct' ':' block 'end while' ) )
            // WJTreeWalker.g:103:4: ^( 'while' expression 'is' 'correct' ':' block 'end while' )
            {
            match(input,63,FOLLOW_63_in_whileStatement527); 

            match(input, Token.DOWN, null); 
            pushFollow(FOLLOW_expression_in_whileStatement529);
            expression33=expression();

            state._fsp--;

            match(input,64,FOLLOW_64_in_whileStatement531); 
            match(input,65,FOLLOW_65_in_whileStatement533); 
            match(input,55,FOLLOW_55_in_whileStatement535); 
            pushFollow(FOLLOW_block_in_whileStatement537);
            block34=block();

            state._fsp--;

            match(input,66,FOLLOW_66_in_whileStatement539); 

            match(input, Token.UP, null); 
            node = new WhileNode(expression33, block34);

            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return node;
    }
    // $ANTLR end "whileStatement"


    // $ANTLR start "expression"
    // WJTreeWalker.g:106:1: expression returns [WJNode node] : ^( OR ( andExpr )+ ) ;
    public final WJNode expression() throws RecognitionException {
        WJNode node = null;

        WJNode andExpr35 = null;



        	ExprNode en = new ExprNode();
        	node = en;

        try {
            // WJTreeWalker.g:111:2: ( ^( OR ( andExpr )+ ) )
            // WJTreeWalker.g:111:4: ^( OR ( andExpr )+ )
            {
            match(input,OR,FOLLOW_OR_in_expression562); 

            match(input, Token.DOWN, null); 
            // WJTreeWalker.g:111:9: ( andExpr )+
            int cnt14=0;
            loop14:
            do {
                int alt14=2;
                int LA14_0 = input.LA(1);

                if ( (LA14_0==AND) ) {
                    alt14=1;
                }


                switch (alt14) {
            	case 1 :
            	    // WJTreeWalker.g:111:10: andExpr
            	    {
            	    pushFollow(FOLLOW_andExpr_in_expression565);
            	    andExpr35=andExpr();

            	    state._fsp--;

            	    en.add(andExpr35);

            	    }
            	    break;

            	default :
            	    if ( cnt14 >= 1 ) break loop14;
                        EarlyExitException eee =
                            new EarlyExitException(14, input);
                        throw eee;
                }
                cnt14++;
            } while (true);


            match(input, Token.UP, null); 
            en.setMode(ExprNode.OR);

            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return node;
    }
    // $ANTLR end "expression"


    // $ANTLR start "andExpr"
    // WJTreeWalker.g:114:1: andExpr returns [WJNode node] : ^( AND ( relExpr )+ ) ;
    public final WJNode andExpr() throws RecognitionException {
        WJNode node = null;

        WJNode relExpr36 = null;



        	ExprNode expr = new ExprNode();
        	node = expr;

        try {
            // WJTreeWalker.g:119:2: ( ^( AND ( relExpr )+ ) )
            // WJTreeWalker.g:119:4: ^( AND ( relExpr )+ )
            {
            match(input,AND,FOLLOW_AND_in_andExpr592); 

            match(input, Token.DOWN, null); 
            // WJTreeWalker.g:119:10: ( relExpr )+
            int cnt15=0;
            loop15:
            do {
                int alt15=2;
                int LA15_0 = input.LA(1);

                if ( (LA15_0==RELATIONAL) ) {
                    alt15=1;
                }


                switch (alt15) {
            	case 1 :
            	    // WJTreeWalker.g:119:11: relExpr
            	    {
            	    pushFollow(FOLLOW_relExpr_in_andExpr595);
            	    relExpr36=relExpr();

            	    state._fsp--;

            	    expr.add(relExpr36);

            	    }
            	    break;

            	default :
            	    if ( cnt15 >= 1 ) break loop15;
                        EarlyExitException eee =
                            new EarlyExitException(15, input);
                        throw eee;
                }
                cnt15++;
            } while (true);


            match(input, Token.UP, null); 
             expr.setMode(ExprNode.AND);

            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return node;
    }
    // $ANTLR end "andExpr"


    // $ANTLR start "relExpr"
    // WJTreeWalker.g:122:1: relExpr returns [WJNode node] : ^( RELATIONAL ( relOp )? ( arimExpr )+ ) ;
    public final WJNode relExpr() throws RecognitionException {
        WJNode node = null;

        int relOp37 = 0;

        WJNode arimExpr38 = null;



        	ExprNode expr = new ExprNode();
        	node = expr;
        	expr.setMode(ExprNode.NOTHING);

        try {
            // WJTreeWalker.g:128:2: ( ^( RELATIONAL ( relOp )? ( arimExpr )+ ) )
            // WJTreeWalker.g:128:4: ^( RELATIONAL ( relOp )? ( arimExpr )+ )
            {
            match(input,RELATIONAL,FOLLOW_RELATIONAL_in_relExpr622); 

            match(input, Token.DOWN, null); 
            // WJTreeWalker.g:128:17: ( relOp )?
            int alt16=2;
            int LA16_0 = input.LA(1);

            if ( ((LA16_0>=69 && LA16_0<=74)) ) {
                alt16=1;
            }
            switch (alt16) {
                case 1 :
                    // WJTreeWalker.g:128:18: relOp
                    {
                    pushFollow(FOLLOW_relOp_in_relExpr625);
                    relOp37=relOp();

                    state._fsp--;

                    expr.setMode(relOp37);

                    }
                    break;

            }

            // WJTreeWalker.g:128:52: ( arimExpr )+
            int cnt17=0;
            loop17:
            do {
                int alt17=2;
                int LA17_0 = input.LA(1);

                if ( (LA17_0==ADDSUB) ) {
                    alt17=1;
                }


                switch (alt17) {
            	case 1 :
            	    // WJTreeWalker.g:128:53: arimExpr
            	    {
            	    pushFollow(FOLLOW_arimExpr_in_relExpr631);
            	    arimExpr38=arimExpr();

            	    state._fsp--;

            	    expr.add(arimExpr38);

            	    }
            	    break;

            	default :
            	    if ( cnt17 >= 1 ) break loop17;
                        EarlyExitException eee =
                            new EarlyExitException(17, input);
                        throw eee;
                }
                cnt17++;
            } while (true);


            match(input, Token.UP, null); 

            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return node;
    }
    // $ANTLR end "relExpr"


    // $ANTLR start "relOp"
    // WJTreeWalker.g:131:1: relOp returns [int op] : ( '==' | '!=' | '>=' | '<=' | '>' | '<' );
    public final int relOp() throws RecognitionException {
        int op = 0;

        try {
            // WJTreeWalker.g:132:2: ( '==' | '!=' | '>=' | '<=' | '>' | '<' )
            int alt18=6;
            switch ( input.LA(1) ) {
            case 69:
                {
                alt18=1;
                }
                break;
            case 70:
                {
                alt18=2;
                }
                break;
            case 71:
                {
                alt18=3;
                }
                break;
            case 72:
                {
                alt18=4;
                }
                break;
            case 73:
                {
                alt18=5;
                }
                break;
            case 74:
                {
                alt18=6;
                }
                break;
            default:
                NoViableAltException nvae =
                    new NoViableAltException("", 18, 0, input);

                throw nvae;
            }

            switch (alt18) {
                case 1 :
                    // WJTreeWalker.g:132:4: '=='
                    {
                    match(input,69,FOLLOW_69_in_relOp651); 
                    op = ExprNode.EQUAL;

                    }
                    break;
                case 2 :
                    // WJTreeWalker.g:133:4: '!='
                    {
                    match(input,70,FOLLOW_70_in_relOp658); 
                    op = ExprNode.NOT_EQUAL;

                    }
                    break;
                case 3 :
                    // WJTreeWalker.g:134:4: '>='
                    {
                    match(input,71,FOLLOW_71_in_relOp665); 
                    op = ExprNode.GREATER_EQUAL;

                    }
                    break;
                case 4 :
                    // WJTreeWalker.g:135:4: '<='
                    {
                    match(input,72,FOLLOW_72_in_relOp672); 
                    op = ExprNode.LESSER_EQUAL;

                    }
                    break;
                case 5 :
                    // WJTreeWalker.g:136:4: '>'
                    {
                    match(input,73,FOLLOW_73_in_relOp679); 
                    op = ExprNode.GREATER;

                    }
                    break;
                case 6 :
                    // WJTreeWalker.g:137:4: '<'
                    {
                    match(input,74,FOLLOW_74_in_relOp687); 
                    op = ExprNode.LESSER;

                    }
                    break;

            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return op;
    }
    // $ANTLR end "relOp"


    // $ANTLR start "arimExpr"
    // WJTreeWalker.g:140:1: arimExpr returns [WJNode node] : ^( ADDSUB ( addSub )* ( mulExpr )+ ) ;
    public final WJNode arimExpr() throws RecognitionException {
        WJNode node = null;

        int addSub39 = 0;

        WJNode mulExpr40 = null;



        	ExprNode expr = new ExprNode();
        	node = expr;
        	expr.setMode(ExprNode.NOTHING);

        try {
            // WJTreeWalker.g:146:2: ( ^( ADDSUB ( addSub )* ( mulExpr )+ ) )
            // WJTreeWalker.g:146:4: ^( ADDSUB ( addSub )* ( mulExpr )+ )
            {
            match(input,ADDSUB,FOLLOW_ADDSUB_in_arimExpr711); 

            match(input, Token.DOWN, null); 
            // WJTreeWalker.g:146:13: ( addSub )*
            loop19:
            do {
                int alt19=2;
                int LA19_0 = input.LA(1);

                if ( ((LA19_0>=75 && LA19_0<=76)) ) {
                    alt19=1;
                }


                switch (alt19) {
            	case 1 :
            	    // WJTreeWalker.g:146:14: addSub
            	    {
            	    pushFollow(FOLLOW_addSub_in_arimExpr714);
            	    addSub39=addSub();

            	    state._fsp--;

            	    expr.setMode(addSub39);expr.addOp(addSub39);

            	    }
            	    break;

            	default :
            	    break loop19;
                }
            } while (true);

            // WJTreeWalker.g:146:75: ( mulExpr )+
            int cnt20=0;
            loop20:
            do {
                int alt20=2;
                int LA20_0 = input.LA(1);

                if ( (LA20_0==MULDIVMOD) ) {
                    alt20=1;
                }


                switch (alt20) {
            	case 1 :
            	    // WJTreeWalker.g:146:76: mulExpr
            	    {
            	    pushFollow(FOLLOW_mulExpr_in_arimExpr720);
            	    mulExpr40=mulExpr();

            	    state._fsp--;

            	    expr.add(mulExpr40);

            	    }
            	    break;

            	default :
            	    if ( cnt20 >= 1 ) break loop20;
                        EarlyExitException eee =
                            new EarlyExitException(20, input);
                        throw eee;
                }
                cnt20++;
            } while (true);


            match(input, Token.UP, null); 

            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return node;
    }
    // $ANTLR end "arimExpr"


    // $ANTLR start "addSub"
    // WJTreeWalker.g:149:1: addSub returns [int op] : ( '+' | '-' );
    public final int addSub() throws RecognitionException {
        int op = 0;

        try {
            // WJTreeWalker.g:150:2: ( '+' | '-' )
            int alt21=2;
            int LA21_0 = input.LA(1);

            if ( (LA21_0==75) ) {
                alt21=1;
            }
            else if ( (LA21_0==76) ) {
                alt21=2;
            }
            else {
                NoViableAltException nvae =
                    new NoViableAltException("", 21, 0, input);

                throw nvae;
            }
            switch (alt21) {
                case 1 :
                    // WJTreeWalker.g:150:4: '+'
                    {
                    match(input,75,FOLLOW_75_in_addSub741); 
                    op = ExprNode.ADD;

                    }
                    break;
                case 2 :
                    // WJTreeWalker.g:151:4: '-'
                    {
                    match(input,76,FOLLOW_76_in_addSub749); 
                    op = ExprNode.SUB;

                    }
                    break;

            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return op;
    }
    // $ANTLR end "addSub"


    // $ANTLR start "mulExpr"
    // WJTreeWalker.g:154:1: mulExpr returns [WJNode node] : ^( MULDIVMOD ( mulDivMod )* ( powExpr )+ ) ;
    public final WJNode mulExpr() throws RecognitionException {
        WJNode node = null;

        int mulDivMod41 = 0;

        WJNode powExpr42 = null;



        	ExprNode expr = new ExprNode();
        	node = expr;
        	expr.setMode(ExprNode.NOTHING);

        try {
            // WJTreeWalker.g:160:2: ( ^( MULDIVMOD ( mulDivMod )* ( powExpr )+ ) )
            // WJTreeWalker.g:160:4: ^( MULDIVMOD ( mulDivMod )* ( powExpr )+ )
            {
            match(input,MULDIVMOD,FOLLOW_MULDIVMOD_in_mulExpr772); 

            match(input, Token.DOWN, null); 
            // WJTreeWalker.g:160:16: ( mulDivMod )*
            loop22:
            do {
                int alt22=2;
                int LA22_0 = input.LA(1);

                if ( ((LA22_0>=77 && LA22_0<=79)) ) {
                    alt22=1;
                }


                switch (alt22) {
            	case 1 :
            	    // WJTreeWalker.g:160:17: mulDivMod
            	    {
            	    pushFollow(FOLLOW_mulDivMod_in_mulExpr775);
            	    mulDivMod41=mulDivMod();

            	    state._fsp--;

            	    expr.setMode(mulDivMod41); expr.addOp(mulDivMod41);

            	    }
            	    break;

            	default :
            	    break loop22;
                }
            } while (true);

            // WJTreeWalker.g:160:86: ( powExpr )+
            int cnt23=0;
            loop23:
            do {
                int alt23=2;
                int LA23_0 = input.LA(1);

                if ( (LA23_0==POW) ) {
                    alt23=1;
                }


                switch (alt23) {
            	case 1 :
            	    // WJTreeWalker.g:160:87: powExpr
            	    {
            	    pushFollow(FOLLOW_powExpr_in_mulExpr781);
            	    powExpr42=powExpr();

            	    state._fsp--;

            	    expr.add(powExpr42);

            	    }
            	    break;

            	default :
            	    if ( cnt23 >= 1 ) break loop23;
                        EarlyExitException eee =
                            new EarlyExitException(23, input);
                        throw eee;
                }
                cnt23++;
            } while (true);


            match(input, Token.UP, null); 

            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return node;
    }
    // $ANTLR end "mulExpr"


    // $ANTLR start "mulDivMod"
    // WJTreeWalker.g:163:1: mulDivMod returns [int op] : ( '*' | '/' | 'mod' );
    public final int mulDivMod() throws RecognitionException {
        int op = 0;

        try {
            // WJTreeWalker.g:164:2: ( '*' | '/' | 'mod' )
            int alt24=3;
            switch ( input.LA(1) ) {
            case 77:
                {
                alt24=1;
                }
                break;
            case 78:
                {
                alt24=2;
                }
                break;
            case 79:
                {
                alt24=3;
                }
                break;
            default:
                NoViableAltException nvae =
                    new NoViableAltException("", 24, 0, input);

                throw nvae;
            }

            switch (alt24) {
                case 1 :
                    // WJTreeWalker.g:164:4: '*'
                    {
                    match(input,77,FOLLOW_77_in_mulDivMod802); 
                    op = ExprNode.MULT;

                    }
                    break;
                case 2 :
                    // WJTreeWalker.g:165:4: '/'
                    {
                    match(input,78,FOLLOW_78_in_mulDivMod810); 
                    op = ExprNode.DIV;

                    }
                    break;
                case 3 :
                    // WJTreeWalker.g:166:4: 'mod'
                    {
                    match(input,79,FOLLOW_79_in_mulDivMod818); 
                    op = ExprNode.MOD;

                    }
                    break;

            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return op;
    }
    // $ANTLR end "mulDivMod"


    // $ANTLR start "powExpr"
    // WJTreeWalker.g:169:1: powExpr returns [WJNode node] : ^( POW ( unaryExpr )+ ) ;
    public final WJNode powExpr() throws RecognitionException {
        WJNode node = null;

        WJNode unaryExpr43 = null;



        	ExprNode expr = new ExprNode();
        	node = expr;
        	expr.setMode(ExprNode.NOTHING);

        try {
            // WJTreeWalker.g:175:2: ( ^( POW ( unaryExpr )+ ) )
            // WJTreeWalker.g:175:4: ^( POW ( unaryExpr )+ )
            {
            match(input,POW,FOLLOW_POW_in_powExpr840); 

            match(input, Token.DOWN, null); 
            // WJTreeWalker.g:175:10: ( unaryExpr )+
            int cnt25=0;
            loop25:
            do {
                int alt25=2;
                int LA25_0 = input.LA(1);

                if ( (LA25_0==FUNCTION_CALL||LA25_0==Identifier||LA25_0==String||(LA25_0>=Number && LA25_0<=Boolean)||LA25_0==53||LA25_0==76||LA25_0==81) ) {
                    alt25=1;
                }


                switch (alt25) {
            	case 1 :
            	    // WJTreeWalker.g:175:11: unaryExpr
            	    {
            	    pushFollow(FOLLOW_unaryExpr_in_powExpr843);
            	    unaryExpr43=unaryExpr();

            	    state._fsp--;

            	    expr.add(unaryExpr43);

            	    }
            	    break;

            	default :
            	    if ( cnt25 >= 1 ) break loop25;
                        EarlyExitException eee =
                            new EarlyExitException(25, input);
                        throw eee;
                }
                cnt25++;
            } while (true);


            match(input, Token.UP, null); 
            expr.setMode(ExprNode.POW);

            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return node;
    }
    // $ANTLR end "powExpr"


    // $ANTLR start "unaryExpr"
    // WJTreeWalker.g:178:1: unaryExpr returns [WJNode node] : ( ^( '-' atom ) | ^( '!' atom ) | atom );
    public final WJNode unaryExpr() throws RecognitionException {
        WJNode node = null;

        WJNode atom44 = null;

        WJNode atom45 = null;

        WJNode atom46 = null;


        try {
            // WJTreeWalker.g:179:2: ( ^( '-' atom ) | ^( '!' atom ) | atom )
            int alt26=3;
            switch ( input.LA(1) ) {
            case 76:
                {
                alt26=1;
                }
                break;
            case 81:
                {
                alt26=2;
                }
                break;
            case FUNCTION_CALL:
            case Identifier:
            case String:
            case Number:
            case Boolean:
            case 53:
                {
                alt26=3;
                }
                break;
            default:
                NoViableAltException nvae =
                    new NoViableAltException("", 26, 0, input);

                throw nvae;
            }

            switch (alt26) {
                case 1 :
                    // WJTreeWalker.g:179:4: ^( '-' atom )
                    {
                    match(input,76,FOLLOW_76_in_unaryExpr867); 

                    match(input, Token.DOWN, null); 
                    pushFollow(FOLLOW_atom_in_unaryExpr869);
                    atom44=atom();

                    state._fsp--;


                    match(input, Token.UP, null); 
                    node = new ExprNode(atom44, ExprNode.NEG);

                    }
                    break;
                case 2 :
                    // WJTreeWalker.g:180:4: ^( '!' atom )
                    {
                    match(input,81,FOLLOW_81_in_unaryExpr880); 

                    match(input, Token.DOWN, null); 
                    pushFollow(FOLLOW_atom_in_unaryExpr882);
                    atom45=atom();

                    state._fsp--;


                    match(input, Token.UP, null); 
                    node = new ExprNode(atom45, ExprNode.NOT);

                    }
                    break;
                case 3 :
                    // WJTreeWalker.g:181:4: atom
                    {
                    pushFollow(FOLLOW_atom_in_unaryExpr893);
                    atom46=atom();

                    state._fsp--;

                    node = atom46;

                    }
                    break;

            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return node;
    }
    // $ANTLR end "unaryExpr"


    // $ANTLR start "atom"
    // WJTreeWalker.g:184:1: atom returns [WJNode node] : ( String | Number | Boolean | Identifier | functionCall | '(' expression ')' );
    public final WJNode atom() throws RecognitionException {
        WJNode node = null;

        CommonTree String47=null;
        CommonTree Number48=null;
        CommonTree Boolean49=null;
        CommonTree Identifier50=null;
        WJNode functionCall51 = null;

        WJNode expression52 = null;


        try {
            // WJTreeWalker.g:185:2: ( String | Number | Boolean | Identifier | functionCall | '(' expression ')' )
            int alt27=6;
            switch ( input.LA(1) ) {
            case String:
                {
                alt27=1;
                }
                break;
            case Number:
                {
                alt27=2;
                }
                break;
            case Boolean:
                {
                alt27=3;
                }
                break;
            case Identifier:
                {
                alt27=4;
                }
                break;
            case FUNCTION_CALL:
                {
                alt27=5;
                }
                break;
            case 53:
                {
                alt27=6;
                }
                break;
            default:
                NoViableAltException nvae =
                    new NoViableAltException("", 27, 0, input);

                throw nvae;
            }

            switch (alt27) {
                case 1 :
                    // WJTreeWalker.g:185:4: String
                    {
                    String47=(CommonTree)match(input,String,FOLLOW_String_in_atom911); 
                    node = new AtomNode(new WJValue((String47!=null?String47.getText():null)));

                    }
                    break;
                case 2 :
                    // WJTreeWalker.g:186:4: Number
                    {
                    Number48=(CommonTree)match(input,Number,FOLLOW_Number_in_atom920); 
                    node = new AtomNode(new WJValue((Number48!=null?Number48.getText():null)));

                    }
                    break;
                case 3 :
                    // WJTreeWalker.g:187:4: Boolean
                    {
                    Boolean49=(CommonTree)match(input,Boolean,FOLLOW_Boolean_in_atom929); 
                    node = new AtomNode(new WJValue((Boolean49!=null?Boolean49.getText():null)));

                    }
                    break;
                case 4 :
                    // WJTreeWalker.g:188:4: Identifier
                    {
                    Identifier50=(CommonTree)match(input,Identifier,FOLLOW_Identifier_in_atom938); 
                    node = new RetrieveNode(currentScope, (Identifier50!=null?Identifier50.getText():null));

                    }
                    break;
                case 5 :
                    // WJTreeWalker.g:189:4: functionCall
                    {
                    pushFollow(FOLLOW_functionCall_in_atom946);
                    functionCall51=functionCall();

                    state._fsp--;

                    node = functionCall51;

                    }
                    break;
                case 6 :
                    // WJTreeWalker.g:190:4: '(' expression ')'
                    {
                    match(input,53,FOLLOW_53_in_atom953); 
                    pushFollow(FOLLOW_expression_in_atom955);
                    expression52=expression();

                    state._fsp--;

                    match(input,54,FOLLOW_54_in_atom957); 
                    node = expression52;

                    }
                    break;

            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return node;
    }
    // $ANTLR end "atom"

    // Delegated rules


    protected DFA10 dfa10 = new DFA10(this);
    static final String DFA10_eotS =
        "\15\uffff";
    static final String DFA10_eofS =
        "\15\uffff";
    static final String DFA10_minS =
        "\1\13\1\2\1\30\12\uffff";
    static final String DFA10_maxS =
        "\1\13\1\2\1\44\12\uffff";
    static final String DFA10_acceptS =
        "\3\uffff\1\1\1\2\1\3\1\4\1\5\1\6\1\7\1\10\1\11\1\12";
    static final String DFA10_specialS =
        "\15\uffff}>";
    static final String[] DFA10_transitionS = {
            "\1\1",
            "\1\2",
            "\1\14\3\uffff\1\3\1\4\1\5\1\6\1\7\1\11\1\10\1\12\1\13",
            "",
            "",
            "",
            "",
            "",
            "",
            "",
            "",
            "",
            ""
    };

    static final short[] DFA10_eot = DFA.unpackEncodedString(DFA10_eotS);
    static final short[] DFA10_eof = DFA.unpackEncodedString(DFA10_eofS);
    static final char[] DFA10_min = DFA.unpackEncodedStringToUnsignedChars(DFA10_minS);
    static final char[] DFA10_max = DFA.unpackEncodedStringToUnsignedChars(DFA10_maxS);
    static final short[] DFA10_accept = DFA.unpackEncodedString(DFA10_acceptS);
    static final short[] DFA10_special = DFA.unpackEncodedString(DFA10_specialS);
    static final short[][] DFA10_transition;

    static {
        int numStates = DFA10_transitionS.length;
        DFA10_transition = new short[numStates][];
        for (int i=0; i<numStates; i++) {
            DFA10_transition[i] = DFA.unpackEncodedString(DFA10_transitionS[i]);
        }
    }

    class DFA10 extends DFA {

        public DFA10(BaseRecognizer recognizer) {
            this.recognizer = recognizer;
            this.decisionNumber = 10;
            this.eot = DFA10_eot;
            this.eof = DFA10_eof;
            this.min = DFA10_min;
            this.max = DFA10_max;
            this.accept = DFA10_accept;
            this.special = DFA10_special;
            this.transition = DFA10_transition;
        }
        public String getDescription() {
            return "61:1: functionCall returns [WJNode node] : ( ^( FUNCTION_CALL Write ( expression )? ) | ^( FUNCTION_CALL WriteLine ( expression )? ) | ^( FUNCTION_CALL ReadString ) | ^( FUNCTION_CALL ReadNumber ) | ^( FUNCTION_CALL Connect ( expression )+ ) | ^( FUNCTION_CALL CharAt stringExpr expression ) | ^( FUNCTION_CALL Length stringExpr ) | ^( FUNCTION_CALL Take expression stringExpr ) | ^( FUNCTION_CALL Drop expression stringExpr ) | ^( FUNCTION_CALL Identifier ( argumentList )? ) );";
        }
    }
 

    public static final BitSet FOLLOW_block_in_walk59 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_BLOCK_in_block86 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_STATEMENTS_in_block89 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_statement_in_block92 = new BitSet(new long[]{0x8000000000001908L});
    public static final BitSet FOLLOW_RETURN_in_block99 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_expression_in_block102 = new BitSet(new long[]{0x0000000000000008L});
    public static final BitSet FOLLOW_assignment_in_statement127 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_functionCall_in_statement134 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_ifStatement_in_statement141 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_whileStatement_in_statement148 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_ASSIGNMENT_in_assignment171 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_Identifier_in_assignment173 = new BitSet(new long[]{0x0000000000020000L});
    public static final BitSet FOLLOW_expression_in_assignment175 = new BitSet(new long[]{0x0000000000000008L});
    public static final BitSet FOLLOW_ARG_LIST_in_argumentList198 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_expression_in_argumentList201 = new BitSet(new long[]{0x0000000000020008L});
    public static final BitSet FOLLOW_PARAM_LIST_in_parameterList219 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_Identifier_in_parameterList221 = new BitSet(new long[]{0x0000000001000008L});
    public static final BitSet FOLLOW_FUNCTION_CALL_in_functionCall245 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_Write_in_functionCall247 = new BitSet(new long[]{0x0000000000020008L});
    public static final BitSet FOLLOW_expression_in_functionCall249 = new BitSet(new long[]{0x0000000000000008L});
    public static final BitSet FOLLOW_FUNCTION_CALL_in_functionCall259 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_WriteLine_in_functionCall261 = new BitSet(new long[]{0x0000000000020008L});
    public static final BitSet FOLLOW_expression_in_functionCall263 = new BitSet(new long[]{0x0000000000000008L});
    public static final BitSet FOLLOW_FUNCTION_CALL_in_functionCall273 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_ReadString_in_functionCall275 = new BitSet(new long[]{0x0000000000000008L});
    public static final BitSet FOLLOW_FUNCTION_CALL_in_functionCall284 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_ReadNumber_in_functionCall286 = new BitSet(new long[]{0x0000000000000008L});
    public static final BitSet FOLLOW_FUNCTION_CALL_in_functionCall295 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_Connect_in_functionCall297 = new BitSet(new long[]{0x0000000000020000L});
    public static final BitSet FOLLOW_expression_in_functionCall299 = new BitSet(new long[]{0x0000000000020008L});
    public static final BitSet FOLLOW_FUNCTION_CALL_in_functionCall311 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_CharAt_in_functionCall313 = new BitSet(new long[]{0x0000002001000000L});
    public static final BitSet FOLLOW_stringExpr_in_functionCall315 = new BitSet(new long[]{0x0000000000020000L});
    public static final BitSet FOLLOW_expression_in_functionCall317 = new BitSet(new long[]{0x0000000000000008L});
    public static final BitSet FOLLOW_FUNCTION_CALL_in_functionCall326 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_Length_in_functionCall328 = new BitSet(new long[]{0x0000002001000000L});
    public static final BitSet FOLLOW_stringExpr_in_functionCall330 = new BitSet(new long[]{0x0000000000000008L});
    public static final BitSet FOLLOW_FUNCTION_CALL_in_functionCall339 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_Take_in_functionCall341 = new BitSet(new long[]{0x0000000000020000L});
    public static final BitSet FOLLOW_expression_in_functionCall343 = new BitSet(new long[]{0x0000002001000000L});
    public static final BitSet FOLLOW_stringExpr_in_functionCall345 = new BitSet(new long[]{0x0000000000000008L});
    public static final BitSet FOLLOW_FUNCTION_CALL_in_functionCall354 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_Drop_in_functionCall356 = new BitSet(new long[]{0x0000000000020000L});
    public static final BitSet FOLLOW_expression_in_functionCall358 = new BitSet(new long[]{0x0000002001000000L});
    public static final BitSet FOLLOW_stringExpr_in_functionCall360 = new BitSet(new long[]{0x0000000000000008L});
    public static final BitSet FOLLOW_FUNCTION_CALL_in_functionCall369 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_Identifier_in_functionCall371 = new BitSet(new long[]{0x0000000000000208L});
    public static final BitSet FOLLOW_argumentList_in_functionCall373 = new BitSet(new long[]{0x0000000000000008L});
    public static final BitSet FOLLOW_String_in_stringExpr393 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_Identifier_in_stringExpr400 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_IF_in_ifStatement424 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_ifStatementPart_in_ifStatement426 = new BitSet(new long[]{0x0000000000006008L});
    public static final BitSet FOLLOW_elseIfStatementPart_in_ifStatement430 = new BitSet(new long[]{0x0000000000006008L});
    public static final BitSet FOLLOW_elseStatementPart_in_ifStatement436 = new BitSet(new long[]{0x0000000000000008L});
    public static final BitSet FOLLOW_IF_in_ifStatementPart457 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_expression_in_ifStatementPart459 = new BitSet(new long[]{0x0000000000000010L});
    public static final BitSet FOLLOW_block_in_ifStatementPart461 = new BitSet(new long[]{0x0000000000000008L});
    public static final BitSet FOLLOW_ELSE_IF_in_elseIfStatementPart480 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_expression_in_elseIfStatementPart482 = new BitSet(new long[]{0x0000000000000010L});
    public static final BitSet FOLLOW_block_in_elseIfStatementPart484 = new BitSet(new long[]{0x0000000000000008L});
    public static final BitSet FOLLOW_ELSE_in_elseStatementPart504 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_block_in_elseStatementPart506 = new BitSet(new long[]{0x0000000000000008L});
    public static final BitSet FOLLOW_63_in_whileStatement527 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_expression_in_whileStatement529 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000001L});
    public static final BitSet FOLLOW_64_in_whileStatement531 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000002L});
    public static final BitSet FOLLOW_65_in_whileStatement533 = new BitSet(new long[]{0x0080000000000000L});
    public static final BitSet FOLLOW_55_in_whileStatement535 = new BitSet(new long[]{0x0000000000000010L});
    public static final BitSet FOLLOW_block_in_whileStatement537 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000004L});
    public static final BitSet FOLLOW_66_in_whileStatement539 = new BitSet(new long[]{0x0000000000000008L});
    public static final BitSet FOLLOW_OR_in_expression562 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_andExpr_in_expression565 = new BitSet(new long[]{0x0000000000040008L});
    public static final BitSet FOLLOW_AND_in_andExpr592 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_relExpr_in_andExpr595 = new BitSet(new long[]{0x0000000000400008L});
    public static final BitSet FOLLOW_RELATIONAL_in_relExpr622 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_relOp_in_relExpr625 = new BitSet(new long[]{0x0000000000100000L});
    public static final BitSet FOLLOW_arimExpr_in_relExpr631 = new BitSet(new long[]{0x0000000000100008L});
    public static final BitSet FOLLOW_69_in_relOp651 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_70_in_relOp658 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_71_in_relOp665 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_72_in_relOp672 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_73_in_relOp679 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_74_in_relOp687 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_ADDSUB_in_arimExpr711 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_addSub_in_arimExpr714 = new BitSet(new long[]{0x0000000000200000L,0x0000000000001800L});
    public static final BitSet FOLLOW_mulExpr_in_arimExpr720 = new BitSet(new long[]{0x0000000000200008L});
    public static final BitSet FOLLOW_75_in_addSub741 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_76_in_addSub749 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_MULDIVMOD_in_mulExpr772 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_mulDivMod_in_mulExpr775 = new BitSet(new long[]{0x0000000000080000L,0x000000000000E000L});
    public static final BitSet FOLLOW_powExpr_in_mulExpr781 = new BitSet(new long[]{0x0000000000080008L});
    public static final BitSet FOLLOW_77_in_mulDivMod802 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_78_in_mulDivMod810 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_79_in_mulDivMod818 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_POW_in_powExpr840 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_unaryExpr_in_powExpr843 = new BitSet(new long[]{0x00200C2001000808L,0x0000000000021000L});
    public static final BitSet FOLLOW_76_in_unaryExpr867 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_atom_in_unaryExpr869 = new BitSet(new long[]{0x0000000000000008L});
    public static final BitSet FOLLOW_81_in_unaryExpr880 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_atom_in_unaryExpr882 = new BitSet(new long[]{0x0000000000000008L});
    public static final BitSet FOLLOW_atom_in_unaryExpr893 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_String_in_atom911 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_Number_in_atom920 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_Boolean_in_atom929 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_Identifier_in_atom938 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_functionCall_in_atom946 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_53_in_atom953 = new BitSet(new long[]{0x0000000000020000L});
    public static final BitSet FOLLOW_expression_in_atom955 = new BitSet(new long[]{0x0040000000000000L});
    public static final BitSet FOLLOW_54_in_atom957 = new BitSet(new long[]{0x0000000000000002L});

}